package sskj.regulatory.presentation.screen.signature.signedlist

import android.support.v7.widget.LinearLayoutManager
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter
import kotlinx.android.synthetic.main.fragment_signed_list.view.*
import sskj.regulatory.R
import sskj.regulatory.presentation.adapter.SignedRecyclerArrayAdapter
import sskj.regulatory.presentation.base_mvp.base.BaseFragment
import javax.inject.Inject


class SignedListFragment : BaseFragment<SignedListContract.View, SignedListContract.Presenter>() {


    @Inject
    lateinit var mPresenter: SignedListPresenter

    private val mAdapter: SignedRecyclerArrayAdapter? = SignedRecyclerArrayAdapter(context)

    override fun initPresenter() = mPresenter

    override fun injectDependencies() {
        activityComponent.inject(this)
    }
    override fun onBackPressed(): Boolean = true

    override fun translucentFull() = false

    override val layoutResId: Int = R.layout.fragment_signed_list

    override fun initView() {
        initRecyclerView()
    }


    private fun initRecyclerView() {

        mCacheView.sgEasyRecyclerView.setLayoutManager(LinearLayoutManager(context,
                LinearLayoutManager.VERTICAL, false))

        mCacheView.sgEasyRecyclerView.adapter = mAdapter

        mCacheView.sgEasyRecyclerView.showEmpty()

        //更多加载
        mAdapter?.setMore(R.layout.view_more, object : RecyclerArrayAdapter.OnMoreListener {

            override fun onMoreShow() {
                //mCaListPresenter.loadMore()
            }

            override fun onMoreClick() {

            }
        })


        //没有更多
        mAdapter?.setNoMore(R.layout.view_no_more)


        //点击事件
        mAdapter?.setOnItemClickListener { _ ->

        }



    }

}